#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<string.h>
void Reverse(char* str, int left, int right)
{
    while (left <= right)
    {
        char t = str[left];
        str[left] = str[right];
        str[right] = t;
    }
}

int main() {
    char str[10000];
    gets(str);
    int len = strlen(str);
    int tmp = 0;
    for (int i = 0; i < len; i++)
    {
        if (!((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')))
        {
            Reverse(str, tmp, i - 1);
            tmp = i + 1;
        }
    }
    for (int i = len - 1; i >= 0; i--)
    {
        if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
            printf("%c", str[i]);
        else
            printf(" ");
    }
    return 0;
}